package edu.gznu.ics.fast.pulsar.controller.prestoacc.taskCtrlController.computeTask;

import edu.gznu.ics.fast.pulsar.model.po.prestoacc.task.computeTask.TaskIdPO;
import edu.gznu.ics.fast.pulsar.model.vo.prestoacc.task.computeTask.TaskListVO;

import edu.gznu.ics.fast.pulsar.model.vo.prestoacc.task.computeTask.TdTaskIdVO;
import edu.gznu.ics.fast.pulsar.model.vo.user.TdUserVO;
import edu.gznu.ics.fast.pulsar.model.vo.web.QueryCommandVO;
import edu.gznu.ics.fast.pulsar.service.prestoacc.taskService.ComputeTask.ComputeTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * Created by fei-zyx on 2016/12/3.
 */
@Controller
@RequestMapping("/tList")
public class EditTaskListController {
    @Autowired
    ComputeTaskService computeTaskService;

    @RequestMapping(value = {"/showTaskId"})
    @ResponseBody
    public List<TaskIdPO> showTaskId(@RequestBody List<QueryCommandVO> queryCommandVO,
                                     HttpServletResponse response) {
        //public String showTaskId(@ModelAttribute @Valid TdUserVO tdUserVO, BindingResult result)
        TdUserVO tdUserVO = null;
        return computeTaskService.findAllTaskIdByUser(tdUserVO);
        //  computeTaskService.addNewTaskList();

    }

    @RequestMapping(value = {"/showTaskList"})

    public List<TaskListVO> showTaskList(@RequestBody List<QueryCommandVO> queryCommandVO,
                                         HttpServletResponse response) {
        return computeTaskService.findTaskListByUser();
        //  computeTaskService.addNewTaskList();

    }

    @RequestMapping(value = {"/edTaskList"})
    public String edTaskList(@ModelAttribute @Valid TdUserVO tdUserVO, BindingResult result) {
        //computeTaskService.modifyTaskListByUser();
        //  computeTaskService.addNewTaskList();
        return "success";
    }


}
